<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script src="./call.js"></script>
    <script src="./apply.js"></script>
    <script src="./bind.js"></script>
    <script>
        let obj = {
            a: 1,
            b: 2
        }

        // 测试bind
        function fn1(...args) {
            console.log(this); // obj
            console.log(args); // [1,2,3,4,5,6]
        }
        // let test = fn1.myBind(obj, 1, 2, 3);
        // test(4, 5, 6);
        // let Fn1 = new test();
        // let test1 = fn1.bind(obj, 9, 8, 7);
        // test1(6, 5, 4);
        // let Fn1 = new test1();


        // 测试call
        function fn2(...args) {
            console.log(this); // obj
            console.log(args); // [1,2,3,4,5]
            return true;
        }
        // fn2.myCall(obj, 1, 2);
        // fn2.call(obj, 3, 4);

        // 测试apply
        function fn3(...args) {
            console.log(this);
            console.log(args);
        }
        // fn3.myApply(obj, [1,2,3,4]) // obj
        // fn3.apply(obj, [1,2,3])
    </script>
</body>

</html>